Test Series - Data Structure

Test Number 48/115

Q: Free lists are used in
A. static memory allocation
B. dynamic memory allocation
C. contagious allocations
D. are used for speeding up linked list operations
Solution: Their property is meant for dynamic allocations.
Q: What are implicit and explicit implementations of freelists?
A. garbage collection and new or malloc operators respectively
B. new or malloc and garbage collection respectively
C. implicit implementation is not favored
D. explicit implementation is not favored
Solution: Gc and new most widely known.
Q: What datastructures can be used in implementing a free list?
A. only linked list
B. linked list or sort trees
C. arrays
D. trees
Solution: Sort trees can also be used in impelementing free lists which remaincomplex.
Q: What are different ways of implementing free lists and which is simple among them?
A. best fit, first fit, worst fit, simple-first fit
B. best fit, first fit, worst fit, simple-best fit
C. best fit, first fit, worst fit, simple-worst fit
D. best fit simple-best fit
Solution: The‭ ‬simplest form of memory management system can be called as first-fit.‭ ‬a device or system maintains a single‭ ‬list of free memory locations.‭ ‬When request to memory is sent,‭ ‬the list is searched and the first block that is large enough is returned.
Q: What is buddy memory management of free lists ?
A. modified version of first fit
B. buddy allocation keeps several‭ ‬free lists,‭ ‬each one holds blocks which are of one particular size
C. modified version of best fit
D. a tree representation of free lists
Solution: When an allocation request is received,‭ ‬the list that holds blocks that are just large enough to satisfy the request are considered, and an open location is returned.‭ ‬If no‭ ‬free‭ ‬blocks that are smaller than two times the size that are requested are available,‭ ‬a larger block is split in two to satisfy the requirements.
Q:  How does implicit free lists(garbage collection) works in adding memory to free list ?
A. whichever comes last will be added to free list
B. whichever comes first will be added to free list
C. certain blocks cannot be used if there are no pointers to them and hence they can be freed
D. makes a probabilistic guess
Solution: When no pointers pointing a block that means it is useless to be in memory.
Q: What are the disadvantages in implementing buddy system algorithm for free lists?
A. internal fragmentation
B. it takes so much space
C. we no more have the hole lists in order of memory address, so it is difficult to detect if 2 holes remain adjacent in memory and shall be merged into one hole
D. both a and c are correct
Solution: Internal fragmentation is an issue to be dealt and it takes so much space.
Q: How are free blocks linked together mostly and in what addressing order?
A. circular linked list and increasing addressing order
B. linked list and decreasing addressing order
C. linked list and in no addressing order
D. none of the mentioned
Solution: A common way is circular linked list and address are arranged in increasing order because merging would be easier which is actually a problem in buddy memory allocation.
Q: Accessing free list very frequently for wide range of addresses can lead to
A. paging
B. segmentation fault
C. memory errors
D. cache problems
Solution: Paging in/out of disk will be caused.

You Have Score    /9